/*
 * @Descripttion: json 处理工具类
 * @Author: 周杨
 * @Date: 2021-09-13 14:55:50
 * @LastEditors: 周杨
 * @LastEditTime: 2021-09-18 16:28:39
 */
/**
 * 尝试从字符串得到json
 * @param {*} txt 源字符串
 * @returns [是否转换成功,转换结果]
 */
 export const tryJson = txt => {
    try {
        if (!txt?.trim()) return [false, null]
        var json = JSON.parse(txt)
        return [true, json]
    } catch {
        return [false, null]
    }
}